<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <textarea name="" id="" cols="30" rows="10" v-model="ipt" @keyup.enter="hander"></textarea>
        <button @click="hander">提交</button>
        <div v-for="(item,index) in list">
            {{item.item}} {{item.count}}
            <button @click="remove(index)">删除</button>
            <button @click="fabulous(index)">点赞</button>
            <button @click="Topping(index)">置顶</button>
        </div>

    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
        let vm = new Vue({
            el: "#app",
            data: {
                ipt: "",
                list: [{
                        item: "111",
                        count: 0
                    },
                    {
                        item: "222",
                        count: 0
                    },

                ],
            },
            methods: {
                hander() {
                    let obj = {
                        item: this.ipt,
                        count: 0
                    }
                    this.list.push(obj)
                },
                remove(index) {
                    this.list.splice(index, 1)
                },
                Topping(index) {
                    this.list.unshift(this.list[index])
                    this.list.splice(index + 1, 1)
                },
                fabulous(index) {
                    this.list[index].count++;
                }

            }
        })
    </script>
</body>

</html>